﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Client
{
   public class WarnInfoProcess:QunYing.Common.IWarnInfoHandle
   {

       QunYing.BLL.DeviceRealTimeInfo bll_dti = new QunYing.BLL.DeviceRealTimeInfo();
        #region IWarnInfoHandle 成员

        void QunYing.Common.IWarnInfoHandle.ProcessWarnInfo(int warnInfoKey)
        {
            if (warnInfoKey == -1) return;
            var vv = bll_dti.GetModel(warnInfoKey);
            if (vv == null)
                return;
            Console.Beep(1000, 1000);
            ShowMessageInfo smi = new ShowMessageInfo();
            smi.messageDateTime = vv.数据发送时间.ToString();
            smi.messageTitle = "告警信息";
            smi.messageType = vv.告警类型;
            smi.messageValue = vv.告警信息描述;
            if (GlobalInfo.UserLoginInfo.角色 == "经销商")
            {
                smi.action = () => { FormWarnOrderAdd fwo = new FormWarnOrderAdd(); fwo.BindData(vv); fwo.ShowDialog(); };
                GlobalInfo.MainForm.Invoke(new Action(() => MessageFormManager.ShowMessageForm(smi)));
            }
        }

        #endregion
    }
}
